package com.zhl.methods_reference6;

public class Test3 {
    public static void main(String[] args) {
        //1.创建一个匿名内部类
//        creatCar car = new creatCar() {
//            @Override
//            public Car create(String name, double price) {
//                return new Car(name, price);
//            }};

        //简化
        //creatCar car = (name, price) -> new Car(name, price);
        //进一步简化  构造器简化
        creatCar car = Car::new;


        Car c =car.create("BMW", 10000000.0);
        System.out.println(c);
    }
}

interface creatCar {
    Car create(String name, double price);
}
